const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  mode: 'development',
  entry: {
    home: path.resolve(__dirname,'src/home.js'),
    other: path.resolve(__dirname,'src/other.js')
  },
  output: {
    filename: '[name].[hash].js',
    path: path.resolve(__dirname,'dist')
  },

  plugins: [
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname,'public/index.html'),
      filename: 'home.html',
      /** 需要放入的js代码块 */
      chunks: ['home']
    }),
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname,'public/index.html'),
      filename: 'other.html',
      chunks: ['other']
    })
  ]
}